﻿using System;

namespace RpcClient.Interface
{
    /// <summary>
    /// Saga事务服务
    /// </summary>
    public interface IRpcSagaTranService
    {  
        /// <summary>
       /// 注册事务
       /// </summary>
       /// <typeparam name="T">事务发起参数</typeparam>
       /// <param name="name">事务名</param>
       /// <param name="rollback">回滚委托</param>
        void RegTran<T>(string name, Action<T, string> rollback) where T : class;
        /// <summary>
        /// 注册事务
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rollback"></param>
        void RegTran<T>(Action<T, string> rollback) where T : class;
        /// <summary>
        /// 注册事务
        /// </summary>
        /// <param name="name"></param>
        /// <param name="rollback"></param>
        void RegTran(string name, Action<string> rollback);
        /// <summary>
        /// 注册事务
        /// </summary>
        /// <typeparam name="Extend"></typeparam>
        /// <param name="name"></param>
        /// <param name="rollback"></param>
        void RegTran<Extend>(string name, Action<Extend> rollback);
        /// <summary>
        /// 注册事务
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="Extend"></typeparam>
        /// <param name="name"></param>
        /// <param name="rollback"></param>
        void RegTran<T, Extend>(string name, Action<T, Extend> rollback) where T : class;
        /// <summary>
        /// 注册事务
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="Extend"></typeparam>
        /// <param name="rollback"></param>
        void RegTran<T, Extend>(Action<T, Extend> rollback) where T : class;
    }
}